<template>
	<view>
		<!-- 拼团专区 -->
		<view class="special ">
			<swiper class="swiper" circular="true" :current="swiperCurrent" :indicator-dots="false" :autoplay="false"  @change="swiperChange">
				<swiper-item v-for="(item,index) in swiperList" :key="index">
					<view class="group">
						<!-- 专区name -->
						<view class="group-special " @click="toPageNew(item)">
							<image class="group-img" src="https://res.suning.cn/project/passport/login/wapV8/images/icon_epp.png" mode=""></image>
							<text class="special-name">{{item.special}}</text>
							<!-- 更多 -->
							<view class="more" >{{item.more}}</view>
						</view>
						<!-- 专区内容 -->
						<view class="make-up" v-for="(swiper,index) in item.mark" :key="index">
							<!-- banner图 -->
							<view class="make-img">
								<image class="make-banner" :src="swiper.img" mode="aspectFit"></image>
							</view>
							<!-- 名称 -->
							<view class="make-right" @click="toGroup">
								<view class="make-right-top">
									<text class="make-group-left">{{swiper.num}}人团</text>
									{{swiper.text}}
								</view>
								<!-- 截至时间 -->
								<view class="make-right-con">
									<text class="data">截至时间：{{swiper.data}}</text>
								</view>
								<!-- 价格 -->
								<view class="make-right-bot">
									<view class="bot">
										<view class="price">
											￥
											<text>{{swiper.price}}</text>
										</view>
										<view class="price-to">
											￥
											<text class="price-num">{{swiper.money}}</text>
										</view>
									</view>
									<view class="my-group">{{swiper.group}}</view>
								</view>
							</view>
						</view>
					</view>
				</swiper-item>

			</swiper>
			<!--重置小圆点的样式  -->
			<view class="dots-container">
			  <view v-for="(item,index) in swiperList" :key="index">
			    <view :class="['dot', index === swiperCurrent ? 'active' : '']"></view>
			  </view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		name: 'group-special',
		props: {
			swiperList: {
				type: Array,
				default: function() {
					return []
				}
			}
		},
		data() {
			return {
				swiperCurrent: 0
			}
		},
		
		methods: {
			swiperChange (e) {
				this.swiperCurrent = e.detail.current
			},
			toPageNew(val) {
				uni.navigateTo({
					url:'/pages/groupbuy/groupbuy'
				})
			},
			toGroup() {
				uni.navigateTo({
					url:'/pages/groupbuy/join-details'
				})
			}
		}
	}
</script>

<style lang="scss">
	.special {
		width: 100%;
		height: 352rpx;
		border-radius: 20rpx;
		background-color: #fff;
		position: relative;

		.swiper {
			width: 100%;
			height: 100%;
			

			.group {
				padding: 0 16rpx;
				height: 100%;

				.group-special {
					padding: 29rpx 0;					
					display: flex;
					align-items: center;
					justify-content: center;

					.group-img {
						width:39rpx;
						height:34rpx;
					}

					.special-name {
						font-size:32rpx;
						font-family:PingFang;
						font-weight:bold;
						color:rgba(51,51,51,1);
						width: 100%;
					}

					.more {
						width:80rpx;
						height:34rpx;
						line-height: 34rpx;
						text-align: center;
						border:1rpx solid #cccccc;
						border-radius: 30rpx;
						font-size:20rpx;
						font-family:PingFang SC;
						font-weight:500;
						color:rgba(153,153,153,1);
					}
				}

				.make-up {
					width: 100%;
					height: 200rpx;
					display: flex;

					.make-img {
						width: 40%;
						height: 100%;
						overflow: hidden;

						.make-banner {
							width: 100%;
							height: 100%;
							display: block;
							border-radius: 12rpx;
						}
					}

					.make-right {
						margin-left: 22rpx;
						height: 100%;
						display: table-cell;
						vertical-align: middle;
						

						.make-right-top {
							display: -webkit-box;
							text-overflow: ellipsis;
							word-break: break-all;
							line-height: 42rpx;
							font-size:28rpx;
							font-family:PingFang;
							font-weight:500;

							.make-group-left {
								display: inline-block;
								width:64rpx;
								line-height:28rpx;
								text-align: center;
								border:1px solid rgba(242,87,113,1);
								border-radius:6rpx;													
								font-size:18rpx;
								font-family:PingFang;
								font-weight:400;
								color:rgba(242,73,82,1);
								margin-right:10rpx;
							}
						}

						.make-right-con {
							margin-top:17rpx;

							.data {
								font-size:22rpx;
								font-family:PingFang;
								font-weight:500;
								color:rgba(51,51,51,1);
							}
						}

						.make-right-bot {
							display: flex;
							justify-content: space-between;
							align-items: flex-end;
							margin-top: 12rpx;

							.bot {
								display: flex;
								align-items: flex-end;

								.price {
									color: #F01D31;
									font-size: 24rpx;
									ffont-family:PingFang;

									text {
										font-size: 32rpx;
										font-weight:bold;
									}
								}

								.price-to {
									color: #A3A3A3;
									font-size: 20rpx;
									margin-left: 10rpx;
									font-family:PingFang-SC-Medium;
									text-decoration: line-through;

									.price-num {
										font-size: 24rpx;

									}
								}
							}

							.my-group {		
								width:152rpx;
								height:50rpx;
								align-items: center;
								line-height:50rpx;
								
								background:linear-gradient(-90deg,rgba(242,73,81,1) 0%,rgba(247,99,124,1) 100%);
								box-shadow:0px 4px 6px 0px rgba(242,77,86,0.2);
								border-radius: 30rpx;
								background: #f76178;
								color: #fff;
								display: flex;
								justify-content: center;
								
							}
						}
					}
				}
			}

		}

		.dots-container {
		  position: absolute;
		  left: 0;
		  right: 0;
		  bottom:20rpx ;
		  display: flex;
		  justify-content: center;
		}
		.dot {
		  margin: 0 6rpx;
		  width: 7rpx;
		  height:7rpx;
		  opacity: 1;
		  background-color:#F7DADF ;
		  border-radius: 2rpx;
		}
		.dot.active {
		  width:24rpx;
		  background-color: #F78C9E;
		}
	}
</style>
